UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'U9vBbfr4DHd6AYqpQiX2Sr2uq0MX4luuBU7Bli60nyc='
WHERE
key_id = 'd906ee8e6d2f308e835273133652823a3d90ea1f32f389afdf9d591dc2837269'
AND (
token = 'U9vBbfr4DHd6AYqpQiX2Sr2uq0MX4luuBU7Bli60nyc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)