UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gdjDG+N5BtkFGYm0Vw7XZ00moQ1cImMYYkM14u11onQ=' 
WHERE 
  key_id = '661bd491081dc6bdb2dba72be76a638ea829073921efc32523c0d1d325334d82' 
  AND (
    token = 'gdjDG+N5BtkFGYm0Vw7XZ00moQ1cImMYYkM14u11onQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023