UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a82uNBCGfXbnK9JoBOuVKg6+d7cRt/pXnQIM5C2X/UA='
WHERE
key_id = 'd7be9cb5c20950aee55236c71b2e7929649d34c497a3617d303a0f1ea39eb371'
AND (
token = 'a82uNBCGfXbnK9JoBOuVKg6+d7cRt/pXnQIM5C2X/UA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)