UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lTbT4MKee2pVpP3XrG2MUm+Al12Sa1iH0QdQJcC3n1s=' 
WHERE 
  key_id = 'ebfbebe7580aa0d8558ac76bb4ace64a6ad8de5540ff8f05acec6e9dc61f025c' 
  AND (
    token = 'lTbT4MKee2pVpP3XrG2MUm+Al12Sa1iH0QdQJcC3n1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036