UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oAQb+9lx7kJYvpLclhAxGalkd1zd4ibOZMFpzktTl4I='
WHERE
key_id = '12abca4d039aab79e8f30c4c035617812fe0b9ad2cdd370e6d95ecfa0ae479be'
AND (
token = 'oAQb+9lx7kJYvpLclhAxGalkd1zd4ibOZMFpzktTl4I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)