UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7cP8W/utSVB46SD4avi+QyPoe4spFqkIVn9vekqhr28='
WHERE
key_id = 'ee8a8e293c7c490c4070917cbf9ab1707c8eaab11245abb2de40b326a5522ae1'
AND (
token = '7cP8W/utSVB46SD4avi+QyPoe4spFqkIVn9vekqhr28='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)