UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PxSBL56KDAUQfyA36oONDuoZx4Ps6T9IcQemPWA/saM=' 
WHERE 
  key_id = '9a65820d49697e1d497e13faebb27a3ec5dc7ffdf7bd3893ce16281a7e27a1e4' 
  AND (
    token = 'PxSBL56KDAUQfyA36oONDuoZx4Ps6T9IcQemPWA/saM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030