UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+6IIu1brmCyTpAJuMxmncqVCMq4mHksSMkViGXIONlA=' 
WHERE 
  key_id = 'eae31bf7fdd127acb4c46c1d4e7ca8961b121ac9a7649f182e29642852902840' 
  AND (
    token = '+6IIu1brmCyTpAJuMxmncqVCMq4mHksSMkViGXIONlA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039