UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LtjpPU54dZXLeiMqlgjniuXF2We+8aXwvmcgAZS8SaU='
WHERE
key_id = 'd04830edc6d811e21b9df94d9d27111ca0f89e6453c70436db3508659e07c3b0'
AND (
token = 'LtjpPU54dZXLeiMqlgjniuXF2We+8aXwvmcgAZS8SaU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)