UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YKRCtqmnRmScU93vg2esvvPU8x0kF77YeiVZ0ZTuA2U=' 
WHERE 
  key_id = '18c64351d05b14d3d17b039556669de20209da3850b29a8d982ccb0158b81b16' 
  AND (
    token = 'YKRCtqmnRmScU93vg2esvvPU8x0kF77YeiVZ0ZTuA2U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043