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