UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Uomy/2NtoNrxlhCKubKcHuuZd8gVkoGPA/p23sA4XIM=' 
WHERE 
  key_id = '1e804ae566d257002328c97aa4919d8bda29234dde986e14278d72ad1b287a23' 
  AND (
    token = 'Uomy/2NtoNrxlhCKubKcHuuZd8gVkoGPA/p23sA4XIM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035