UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lqscTte69iAPDibxqbR/m74czRU5r4TFiRXhHU5dYRI=' 
WHERE 
  key_id = 'fed56b5a4de37f2353ce285e954d5f6edcf94c5fa13fd25fcf2a17aeda547d9d' 
  AND (
    token = 'lqscTte69iAPDibxqbR/m74czRU5r4TFiRXhHU5dYRI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026