UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xdP0xhOMvdUW68HMio5I96ho9MdOukOIb+Mdh6rDx3o='
WHERE
key_id = 'e4a6463325e41f357d3ed7e16ebd5ad510e146bebcfa1416e4d608916953854b'
AND (
token = 'xdP0xhOMvdUW68HMio5I96ho9MdOukOIb+Mdh6rDx3o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)