UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aaVm3Xdu8+sS8MBDs3VIcOF7YtARIB6fKYsLMCeauxg=' 
WHERE 
  key_id = 'd847dc4430135230a6caa48b9edc5ccade51bb1bdcfa2ab02186348ad4c501e3' 
  AND (
    token = 'aaVm3Xdu8+sS8MBDs3VIcOF7YtARIB6fKYsLMCeauxg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050