UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X9UvscN1lrzbn6euyhv6JwGnP9WcGgNBUtHUWGxlzzQ='
WHERE
key_id = 'bb86f1c689261b1821c18ced09c6d561c12eb2ee25b9ccf826ce9247eb1ee738'
AND (
token = 'X9UvscN1lrzbn6euyhv6JwGnP9WcGgNBUtHUWGxlzzQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)