UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BRaG82MjZVHJjFirMnuPGlrf0R9E6q75GpS3tAoVp8Q='
WHERE
key_id = '0f8f2b20066060161a4ad4ac8b5a2514bd44e183dec0b0b6050aa3098031c5bc'
AND (
token = 'BRaG82MjZVHJjFirMnuPGlrf0R9E6q75GpS3tAoVp8Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)