UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l9vhxnewCJb8TKz9m08BMDT+gXw1SUpmgVu6Aw2agU8=' 
WHERE 
  key_id = '7545a27679c8e15887ed3beea5097430d9a24bd1e0520483fe625367d5495133' 
  AND (
    token = 'l9vhxnewCJb8TKz9m08BMDT+gXw1SUpmgVu6Aw2agU8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052