UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y80o6X38HysQHjajWRMGKxSKIYxiCyhVin92vZJH6lw='
WHERE
key_id = '197850d242c1e7bb1f3d69200ed5dc037c4195155a8d19c1f627c691027df889'
AND (
token = 'y80o6X38HysQHjajWRMGKxSKIYxiCyhVin92vZJH6lw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)