UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aN42kXrSuJWIljl7u+1Wq5sEvXfYibH1nj/otEUVJP8=' 
WHERE 
  key_id = 'e94a47f18f414a2d0743e9e703c2673bb5b854c1425b14845689cf07b88ca9f4' 
  AND (
    token = 'aN42kXrSuJWIljl7u+1Wq5sEvXfYibH1nj/otEUVJP8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024