UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm85lieZelZ7M+GWpQw8kOZyylSJDu7+V9y5C69YmSpw='
WHERE
key_id = 'c789905e3b23d280f9cb46eccb7278c3d35b6e8af066551edbb9c050bfd42674'
AND (
token = 'm85lieZelZ7M+GWpQw8kOZyylSJDu7+V9y5C69YmSpw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)