UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZFqBsY8kGv1a2y9VSU4g1BCYMpzkjaKrxXAQhUAzTPw='
WHERE
key_id = '770a7654e30c5031d30b0d776cd3771d1d5dd40b9b1fbb1dfcdf2481a58c0353'
AND (
token = 'ZFqBsY8kGv1a2y9VSU4g1BCYMpzkjaKrxXAQhUAzTPw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)