UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8B4s6xICvKuWglmSyDrAvX85WOzhOORPCeFHZi/aI48='
WHERE
key_id = 'd0b844d63961ee3f15219205ea15a00f0d35b4cfc657e0ac774059da3af5be36'
AND (
token = '8B4s6xICvKuWglmSyDrAvX85WOzhOORPCeFHZi/aI48='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)