UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tXhhqSiHha95ex0/60dvi5mmP5TMdMysZ1Duf4Sxj/g='
WHERE
key_id = 'bef27b34b8be9daab9914725b16528d66560e14ebe58e513e0dce13ae39a5ce8'
AND (
token = 'tXhhqSiHha95ex0/60dvi5mmP5TMdMysZ1Duf4Sxj/g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)