UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1LCZO+iwgTLnuF3oC/HukgrGujSgUEyW+D3ixqvYbWA=' 
WHERE 
  key_id = '13e3336389ccbe6c2a62dd399761587b0738ae8d5836e0906effa93084ba5648' 
  AND (
    token = '1LCZO+iwgTLnuF3oC/HukgrGujSgUEyW+D3ixqvYbWA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026