UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dVccaeB7eGWk5R2ZFFRzmNOqXvlAXZS5R5eehvkfzHI=' 
WHERE 
  key_id = 'ed76572f1b79a90a489abb255bf45fd4c3e8ef9f37e529578517cd6e069fb31a' 
  AND (
    token = 'dVccaeB7eGWk5R2ZFFRzmNOqXvlAXZS5R5eehvkfzHI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031