UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H66+QA+clSPvSbgYBsliJCD/jMB6pCv4A0tC7A+JHfY=' 
WHERE 
  key_id = 'a93e38baed433ef873f0f10e4480a9af2d26f49690a5c3b43981640ba297c50a' 
  AND (
    token = 'H66+QA+clSPvSbgYBsliJCD/jMB6pCv4A0tC7A+JHfY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050