UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XG5dxfcXbe8hLFkygINSH8MrE8SVSDdczE8IddLst2g=' 
WHERE 
  key_id = 'dac5804bc87ee0ea8c63869aa0c27a58c888c522e5781f7b6fdb6c2507172022' 
  AND (
    token = 'XG5dxfcXbe8hLFkygINSH8MrE8SVSDdczE8IddLst2g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026