UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0WtvYnbY+SdxBc+VBpWczg89t0p1g3ptRMWhbs5vOgc='
WHERE
key_id = 'a9c40449ad25d8b7540a629786420b4da4d123edd04925600fc10aee840328d8'
AND (
token = '0WtvYnbY+SdxBc+VBpWczg89t0p1g3ptRMWhbs5vOgc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)