UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zgt86OgJRPYT+k9OWHgryFEYBSYCqFAARzOnmiHtd8I='
WHERE
key_id = 'a59beebf93e06879f66bf2e2f05755688aaa78a28b9054808b0422749aeac050'
AND (
token = 'zgt86OgJRPYT+k9OWHgryFEYBSYCqFAARzOnmiHtd8I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)