UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BSDCe6nXMWgASmLFFNeuYKnK8jGRkfy66kKcqhx7E80='
WHERE
key_id = '7360c445799df30a3716580cfd2428a7d14afb5708b38db98e646c92d0c33b0b'
AND (
token = 'BSDCe6nXMWgASmLFFNeuYKnK8jGRkfy66kKcqhx7E80='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)