UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S9RiP4COiOUBZt3QFqX/Uhf92czNmK5WvlrAY+STwZg='
WHERE
key_id = '8d82493e5ba5128c7ff26cf73f287024da679bf1365952c00788e4236aefb40f'
AND (
token = 'S9RiP4COiOUBZt3QFqX/Uhf92czNmK5WvlrAY+STwZg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)