UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O0Hn3a/QV61pb1CGQsdnfc/w6kwpAlUMjBwXwRKiFF4=' 
WHERE 
  key_id = '7cee4b9c8b7c7d63780cde0b34af666be5b9d5f0b0dd4e6bc19bd57434840585' 
  AND (
    token = 'O0Hn3a/QV61pb1CGQsdnfc/w6kwpAlUMjBwXwRKiFF4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032