UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nvRRaeIdVtYFGNP4a+SvwduP3XZRiWEMZdVAce0+V3U='
WHERE
key_id = 'a8d4fd5e566bfe61cac1819db24a717d0f50bcaec82563627c71cf38d99e0055'
AND (
token = 'nvRRaeIdVtYFGNP4a+SvwduP3XZRiWEMZdVAce0+V3U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)